<?php

//基本栏目控制器
class About extends Controller {

	var $viewpath;
	var $is_logined;
	var $prepage = 5;
	
	function About()
	{
		parent::Controller();
		$this->viewpath = 'admin/'.__CLASS__;
		$this->load->model('managers_model','mm');
		$this->load->model("about_model");
		$this->is_logined = $this->mm->is_logined();
	}
	
	//默认首页
	function index()
	{
		if($dosubmit = p("dosubmit")) {
			$type = p("type");
			$content = p("content");
			$result = $this->about_model->update($content, $type);
			if($result) {//提示成功
				admin_show_success("更新成功", $this->config->item('admin_path')."/about/".$type);
			} else {
				admin_show_failed("更新失败");
			}
		}
		$type = u(3);
		switch ($type) {
			case "contact":
				$viewdata["title"] = "联系我们";
			break;
			case "ad":
				$viewdata["title"] = "违规举报";
			break;
			case "hr":
				$viewdata["title"] = "职位招聘";
			break;
			case "partner":
				$viewdata["title"] = "合作伙伴";
			break;
			case "sitemap":
				$viewdata["title"] = "网站地图";
			break;
			case "help":
				$viewdata["title"] = "帮助中心";
			break;
			case "legal":
				$viewdata["title"] = "法律声明";
			break;
			default:
				$viewdata["title"] = "关于我们";
		}
		//获取数据
		$row = $this->about_model->get($type);
		$viewdata["row"] = $row;
		$viewdata["type"] = $type;
		$this->load->view($this->viewpath.'/index', $viewdata);
	}
}

/* End of file */